import 'package:yqmssa_app/generated/json/base/json_convert_content.dart';
import 'package:yqmssa_app/views/login/login_entity.dart';

LoginEntity $LoginEntityFromJson(Map<String, dynamic> json) {
  final LoginEntity loginEntity = LoginEntity();
  final String? token = jsonConvert.convert<String>(json['token']);
  if (token != null) {
    loginEntity.token = token;
  }
  final bool? isHavingInfo = jsonConvert.convert<bool>(json['is_having_info']);
  if (isHavingInfo != null) {
    loginEntity.isHavingInfo = isHavingInfo;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatars']);
  if (avatar != null) {
    loginEntity.avatar = avatar;
  }
  final int? jumpXcx = jsonConvert.convert<int>(json['jump_xcx']);
  if (jumpXcx != null) {
    loginEntity.jumpXcx = jumpXcx;
  }
  final int? openChat = jsonConvert.convert<int>(json['open_chat']);
  if (openChat != null) {
    loginEntity.openChat = openChat;
  }
  final int? isLink = jsonConvert.convert<int>(json['is_link']);
  if (isLink != null) {
    loginEntity.isLink = isLink;
  }
  final int? jumpScan = jsonConvert.convert<int>(json['jump_scan']);
  if (jumpScan != null) {
    loginEntity.jumpScan = jumpScan;
  }
  final int? isOpenAb = jsonConvert.convert<int>(json['is_open_ab']);
  if (isOpenAb != null) {
    loginEntity.isOpenAb = isOpenAb;
  }
  final int? isXcx = jsonConvert.convert<int>(json['is_xcx']);
  if (isXcx != null) {
    loginEntity.isXcx = isXcx;
  }
  final int? isChat = jsonConvert.convert<int>(json['is_chat']);
  if (isChat != null) {
    loginEntity.isChat = isChat;
  }
  final int? chatBot = jsonConvert.convert<int>(json['chat_bot']);
  if (chatBot != null) {
    loginEntity.chatBot = chatBot;
  }
  final int? havePop = jsonConvert.convert<int>(json['have_pop']);
  if (havePop != null) {
    loginEntity.havePop = havePop;
  }
  final int? haveCall = jsonConvert.convert<int>(json['have_call']);
  if (haveCall != null) {
    loginEntity.haveCall = haveCall;
  }
  final String? chatWeText = jsonConvert.convert<String>(json['chat_we_text']);
  if (chatWeText != null) {
    loginEntity.chatWeText = chatWeText;
  }
  final LoginAddWxButton? addWxButton = jsonConvert.convert<LoginAddWxButton>(json['add_wx_button']);
  if (addWxButton != null) {
    loginEntity.addWxButton = addWxButton;
  }
  return loginEntity;
}

Map<String, dynamic> $LoginEntityToJson(LoginEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['token'] = entity.token;
  data['is_having_info'] = entity.isHavingInfo;
  data['avatars'] = entity.avatar;
  data['jump_xcx'] = entity.jumpXcx;
  data['open_chat'] = entity.openChat;
  data['is_link'] = entity.isLink;
  data['jump_scan'] = entity.jumpScan;
  data['is_open_ab'] = entity.isOpenAb;
  data['is_xcx'] = entity.isXcx;
  data['is_chat'] = entity.isChat;
  data['chat_bot'] = entity.chatBot;
  data['have_pop'] = entity.havePop;
  data['have_call'] = entity.haveCall;
  data['chat_we_text'] = entity.chatWeText;
  data['add_wx_button'] = entity.addWxButton.toJson();
  return data;
}

extension LoginEntityExtension on LoginEntity {
  LoginEntity copyWith({
    String? token,
    bool? isHavingInfo,
    String? avatar,
    int? jumpXcx,
    int? openChat,
    int? isLink,
    int? jumpScan,
    int? isOpenAb,
    int? isXcx,
    int? isChat,
    int? chatBot,
    int? havePop,
    int? haveCall,
    String? chatWeText,
    LoginAddWxButton? addWxButton,
  }) {
    return LoginEntity()
      ..token = token ?? this.token
      ..isHavingInfo = isHavingInfo ?? this.isHavingInfo
      ..avatar = avatar ?? this.avatar
      ..jumpXcx = jumpXcx ?? this.jumpXcx
      ..openChat = openChat ?? this.openChat
      ..isLink = isLink ?? this.isLink
      ..jumpScan = jumpScan ?? this.jumpScan
      ..isOpenAb = isOpenAb ?? this.isOpenAb
      ..isXcx = isXcx ?? this.isXcx
      ..isChat = isChat ?? this.isChat
      ..chatBot = chatBot ?? this.chatBot
      ..havePop = havePop ?? this.havePop
      ..haveCall = haveCall ?? this.haveCall
      ..chatWeText = chatWeText ?? this.chatWeText
      ..addWxButton = addWxButton ?? this.addWxButton;
  }
}

LoginAddWxButton $LoginAddWxButtonFromJson(Map<String, dynamic> json) {
  final LoginAddWxButton loginAddWxButton = LoginAddWxButton();
  final int? addWxView = jsonConvert.convert<int>(json['add_wx_view']);
  if (addWxView != null) {
    loginAddWxButton.addWxView = addWxView;
  }
  final String? chatWeText = jsonConvert.convert<String>(json['chat_we_text']);
  if (chatWeText != null) {
    loginAddWxButton.chatWeText = chatWeText;
  }
  return loginAddWxButton;
}

Map<String, dynamic> $LoginAddWxButtonToJson(LoginAddWxButton entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['add_wx_view'] = entity.addWxView;
  data['chat_we_text'] = entity.chatWeText;
  return data;
}

extension LoginAddWxButtonExtension on LoginAddWxButton {
  LoginAddWxButton copyWith({
    int? addWxView,
    String? chatWeText,
  }) {
    return LoginAddWxButton()
      ..addWxView = addWxView ?? this.addWxView
      ..chatWeText = chatWeText ?? this.chatWeText;
  }
}
